# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-net-subnet
_pkgname=Net-Subnet
pkgver=1.03
pkgrel=13
pkgdesc='Fast IP-in-subnet matcher for IPv4 and IPv6, CIDR or mask.'
arch=('any')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
url='https://metacpan.org/pod/Net::Subnet'
source=("http://search.cpan.org/CPAN/authors/id/J/JU/JUERD/$_pkgname-$pkgver.tar.gz")
sha512sums=('a28518e63736021c2c33959c13b54ec4dce0f43854f824c551b585db96ef001e62f6ce413cbc946aaa6cfa28cc4631973074c8980c1b0507f37390f4d8c70fd4')

prepare() {
  cd "$_pkgname-$pkgver"

  export PERL_MM_USE_DEFAULT=1 PERL5LIB="" \
    PERL_AUTOINSTALL=--skipdeps \
    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \
    PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
    MODULEBUILDRC=/dev/null

  /usr/bin/perl Makefile.PL
}

build() {
  cd "$_pkgname-$pkgver"

  make
}

package() {
  cd "$_pkgname-$pkgver"

  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}

